/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package entity;

import java.io.Serializable;
import java.math.BigDecimal;
import java.util.Collection;
import java.util.Date;
import javax.persistence.*;
import javax.validation.constraints.NotNull;
import javax.validation.constraints.Size;
import javax.xml.bind.annotation.XmlRootElement;
import javax.xml.bind.annotation.XmlTransient;

/**
 *
 * @author 7P7
 */
@Entity
@Table(name = "Event", catalog = "NationalLevelPaperPresentation", schema = "dbo")
@XmlRootElement
@NamedQueries({
    @NamedQuery(name = "Event.findAll", query = "SELECT e FROM Event e"),
    @NamedQuery(name = "Event.topNewNews", query = "SELECT e FROM Event e order by e.eventID desc"),
    @NamedQuery(name = "Event.topFreeNews", query = "SELECT e FROM Event e where e.fee = 0"),
    @NamedQuery(name = "Event.findByEventID", query = "SELECT e FROM Event e WHERE e.eventID = :eventID"),
    @NamedQuery(name = "Event.findByTopic", query = "SELECT e FROM Event e WHERE e.topic = :topic"),
    @NamedQuery(name = "Event.findByCreateDate", query = "SELECT e FROM Event e WHERE e.createDate = :createDate"),
    @NamedQuery(name = "Event.findByStartDate", query = "SELECT e FROM Event e WHERE e.startDate = :startDate"),
    @NamedQuery(name = "Event.findByEndDate", query = "SELECT e FROM Event e WHERE e.endDate = :endDate"),
    @NamedQuery(name = "Event.findByLocated", query = "SELECT e FROM Event e WHERE e.located = :located"),
    @NamedQuery(name = "Event.findByMaxNoOfParticipants", query = "SELECT e FROM Event e WHERE e.maxNoOfParticipants = :maxNoOfParticipants"),
    @NamedQuery(name = "Event.findByCurNoOfParticipants", query = "SELECT e FROM Event e WHERE e.curNoOfParticipants = :curNoOfParticipants"),
    @NamedQuery(name = "Event.findByFee", query = "SELECT e FROM Event e WHERE e.fee = :fee"),
    @NamedQuery(name = "Event.findByImageurl", query = "SELECT e FROM Event e WHERE e.imageurl = :imageurl")})
public class Event implements Serializable {
    private static final long serialVersionUID = 1L;
    @Id
    @Basic(optional = false)
    @NotNull
    @Column(name = "EventID", nullable = false)
    private Integer eventID;
    @Size(max = 150)
    @Column(name = "Topic", length = 150)
    private String topic;
    @Column(name = "CreateDate")
    @Temporal(TemporalType.TIMESTAMP)
    private Date createDate;
    @Column(name = "StartDate")
    @Temporal(TemporalType.TIMESTAMP)
    private Date startDate;
    @Column(name = "EndDate")
    @Temporal(TemporalType.TIMESTAMP)
    private Date endDate;
    @Size(max = 100)
    @Column(name = "Located", length = 100)
    private String located;
    @Column(name = "MaxNoOfParticipants")
    private Long maxNoOfParticipants;
    @Column(name = "CurNoOfParticipants")
    private Long curNoOfParticipants;
    // @Max(value=?)  @Min(value=?)//if you know range of your decimal fields consider using these annotations to enforce field validation
    @Column(name = "Fee", precision = 10, scale = 2)
    private BigDecimal fee;
    @Size(max = 100)
    @Column(name = "Image_url", length = 100)
    private String imageurl;
    @Lob
    @Size(max = 2147483647)
    @Column(name = "Details", length = 2147483647)
    private String details;
    @OneToMany(mappedBy = "eventID")
    private Collection<Prize> prizeCollection;
    @OneToMany(mappedBy = "eventID")
    private Collection<Message> messageCollection;
    @OneToMany(mappedBy = "eventID")
    private Collection<Enrolment> enrolmentCollection;
    @JoinColumn(name = "SpeakerID", referencedColumnName = "SpeakerID")
    @ManyToOne
    private Speaker speakerID;
    @JoinColumn(name = "CreatePerID", referencedColumnName = "PerID")
    @ManyToOne
    private Person createPerID;
    @JoinColumn(name = "CategoryID", referencedColumnName = "CategoryID")
    @ManyToOne
    private Category categoryID;

    public Event() {
    }

    public Event(Integer eventID) {
        this.eventID = eventID;
    }

    public Integer getEventID() {
        return eventID;
    }

    public void setEventID(Integer eventID) {
        this.eventID = eventID;
    }

    public String getTopic() {
        return topic;
    }

    public void setTopic(String topic) {
        this.topic = topic;
    }

    public Date getCreateDate() {
        return createDate;
    }

    public void setCreateDate(Date createDate) {
        this.createDate = createDate;
    }

    public Date getStartDate() {
        return startDate;
    }

    public void setStartDate(Date startDate) {
        this.startDate = startDate;
    }

    public Date getEndDate() {
        return endDate;
    }

    public void setEndDate(Date endDate) {
        this.endDate = endDate;
    }

    public String getLocated() {
        return located;
    }

    public void setLocated(String located) {
        this.located = located;
    }

    public Long getMaxNoOfParticipants() {
        return maxNoOfParticipants;
    }

    public void setMaxNoOfParticipants(Long maxNoOfParticipants) {
        this.maxNoOfParticipants = maxNoOfParticipants;
    }

    public Long getCurNoOfParticipants() {
        return curNoOfParticipants;
    }

    public void setCurNoOfParticipants(Long curNoOfParticipants) {
        this.curNoOfParticipants = curNoOfParticipants;
    }

    public BigDecimal getFee() {
        return fee;
    }

    public void setFee(BigDecimal fee) {
        this.fee = fee;
    }

    public String getImageurl() {
        return imageurl;
    }

    public void setImageurl(String imageurl) {
        this.imageurl = imageurl;
    }

    public String getDetails() {
        return details;
    }

    public void setDetails(String details) {
        this.details = details;
    }

    @XmlTransient
    public Collection<Prize> getPrizeCollection() {
        return prizeCollection;
    }

    public void setPrizeCollection(Collection<Prize> prizeCollection) {
        this.prizeCollection = prizeCollection;
    }

    @XmlTransient
    public Collection<Message> getMessageCollection() {
        return messageCollection;
    }

    public void setMessageCollection(Collection<Message> messageCollection) {
        this.messageCollection = messageCollection;
    }

    @XmlTransient
    public Collection<Enrolment> getEnrolmentCollection() {
        return enrolmentCollection;
    }

    public void setEnrolmentCollection(Collection<Enrolment> enrolmentCollection) {
        this.enrolmentCollection = enrolmentCollection;
    }

    public Speaker getSpeakerID() {
        return speakerID;
    }

    public void setSpeakerID(Speaker speakerID) {
        this.speakerID = speakerID;
    }

    public Person getCreatePerID() {
        return createPerID;
    }

    public void setCreatePerID(Person createPerID) {
        this.createPerID = createPerID;
    }

    public Category getCategoryID() {
        return categoryID;
    }

    public void setCategoryID(Category categoryID) {
        this.categoryID = categoryID;
    }

    @Override
    public int hashCode() {
        int hash = 0;
        hash += (eventID != null ? eventID.hashCode() : 0);
        return hash;
    }

    @Override
    public boolean equals(Object object) {
        // TODO: Warning - this method won't work in the case the id fields are not set
        if (!(object instanceof Event)) {
            return false;
        }
        Event other = (Event) object;
        if ((this.eventID == null && other.eventID != null) || (this.eventID != null && !this.eventID.equals(other.eventID))) {
            return false;
        }
        return true;
    }

    @Override
    public String toString() {
        return "entity.Event[ eventID=" + eventID + " ]";
    }
    
}
